﻿@using GameSchool.HtmlHelpers
@using GameSchool.Models.AccountModels
@model GameSchool.ViewModels.Account.EditViewModel
@{
    ViewBag.Title = "Breyta notanda";
}
<h2>
    Breyta notanda</h2>
<p>
    Notaðu formið hér að neðan til þess að breyta upplýsingum um notanda.
</p>
<p>
    Lykilorð þurfa að vera að minnskta kosti @Membership.MinRequiredPasswordLength stafir
    að lengd.
</p>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm(htmlAttributes: new { @class = "form-horizontal" }))
{
    @Html.ValidationSummary(true, "Ekki tókst að skrá notanda. Vinsamlegast leiðréttu villurnar og reyndu aftur.")
    <div>
        <fieldset>
            <legend>Notandaupplýsingar</legend>
            <div class="control-group">
                @Html.LabelFor(m => m.userModel.FullName, new { @class = "control-label" })
                <div class="controls">
                    @Html.TextBoxFor(m => m.userModel.FullName, new { @class = "input-xlarge" })
                    @Html.ValidationMessageFor(m => m.userModel.FullName)
                </div>
            </div>
            <div class="control-group">
                @Html.LabelFor(m => m.userModel.SSN, new { @class = "control-label" })
                <div class="controls">
                    @Html.TextBoxFor(m => m.userModel.SSN, new { @class = "input-xlarge" })
                    @Html.ValidationMessageFor(m => m.userModel.SSN)
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">
                    Kyn</label>
                <div class="controls">
                    <label class="radio" for="Gender-Karl">
                        @if (Model.userModel.Gender == AccountProperties.Gender.Karl)
                        {
                            @Html.RadioButtonFor(m => m.userModel.Gender, AccountProperties.Gender.Karl, new { id = "Gender-Karl", @checked = "checked" })
                        }
                        else
                        {
                            @Html.RadioButtonFor(m => m.userModel.Gender, AccountProperties.Gender.Karl, new { id = "Gender-Karl" })
                        }
                        Karl
                    </label>
                    <label class="radio" for="Gender-Kona">
                        @if (Model.userModel.Gender == AccountProperties.Gender.Kona)
                        {
                            @Html.RadioButtonFor(m => m.userModel.Gender, AccountProperties.Gender.Kona, new { id = "Gender-Kona", @checked = "checked" })
                        }
                        else
                        {
                            @Html.RadioButtonFor(m => m.userModel.Gender, AccountProperties.Gender.Kona, new { id = "Gender-Kona" })
                        }
                        Kona
                    </label>
                </div>
            </div>
            <div class="control-group">
                @Html.LabelFor(m => m.userModel.Street, new { @class = "control-label" })
                <div class="controls">
                    @Html.TextBoxFor(m => m.userModel.Street, new { @class = "input-xlarge" })
                    @Html.ValidationMessageFor(m => m.userModel.Street)
                </div>
            </div>
            <div class="control-group">
                @Html.LabelFor(m => m.userModel.PostalCode, new { @class = "control-label" })
                <div class="controls">
                    @Html.DropDownListFor(m => m.userModel.PostalCode, Model.postalCodeRegions, new { @class = "span3" })
                    @Html.ValidationMessageFor(m => m.userModel.PostalCode)
                </div>
            </div>
            <div class="control-group">
                @Html.LabelFor(m => m.userModel.PhoneNumber, new { @class = "control-label" })
                <div class="controls">
                    @Html.TextBoxFor(m => m.userModel.PhoneNumber, new { @class = "input-xlarge" })
                    @Html.ValidationMessageFor(m => m.userModel.PhoneNumber)
                </div>
            </div>
            <hr />
            <div class="control-group">
                <label class="control-label">
                    Tegund notanda</label>
                <div class="controls">
                    <label class="radio" for="UserType-Nemandi">
                        @Html.RadioButtonFor(m => m.userModel.UserType, AccountProperties.UserType.Nemandi, new { id = "UserType-Nemandi", @checked = "checked", @disabled = "" })
                        Nemandi
                    </label>
                    <label class="radio" for="UserType-Kennari">
                        @Html.RadioButtonFor(m => m.userModel.UserType, AccountProperties.UserType.Kennari, new { id = "UserType-Kennari", @disabled = "" })
                        Kennari
                    </label>
                </div>
            </div>
            <div class="control-group">
                @Html.LabelFor(m => m.userModel.DepartmentDegreeId, new { @class = "control-label" })
                <div class="controls">
                    @Html.DropDownListFor(m => m.userModel.DepartmentDegreeId, Model.departmentDegrees, new { @class = "span3" })
                    @Html.ValidationMessageFor(m => m.userModel.DepartmentDegreeId)
                </div>
            </div>
            <hr />
            <div class="control-group">
                @Html.LabelFor(m => m.userModel.Email, new { @class = "control-label" })
                <div class="controls">
                    @Html.TextBoxFor(m => m.userModel.Email, new { @class = "input-xlarge" })
                    @Html.ValidationMessageFor(m => m.userModel.Email)
                </div>
            </div>
            <div class="control-group">
                @Html.LabelFor(m => m.userModel.UserName, new { @class = "control-label" })
                <div class="controls">
                    <span class="input-xlarge uneditable-input">@Model.userModel.UserName</span>
                </div>
            </div>
            <div class="form-actions">
                <input type="submit" class="btn btn-primary" value="Uppfæra notanda" />
                <a href="@Url.Action("List")" class="btn">Til baka í notendalista</a>
            </div>
        </fieldset>
    </div>
}
